BY_HANDLE_FILE_INFORMATION (Structures)
Last changed: imaginarydevelopment@googlemail.com-50.193.161.217

.
Summary

C# Definition:

[StructLayout(LayoutKind.Sequential)]
struct BY_HANDLE_FILE_INFORMATION {
        public uint FileAttributes;
        public FILETIME CreationTime;
        public FILETIME LastAccessTime;
        public FILETIME LastWriteTime;
        public uint VolumeSerialNumber;
        public uint FileSizeHigh;
        public uint FileSizeLow;
        public uint NumberOfLinks;
        public uint FileIndexHigh;
        public uint FileIndexLow;
}

VB Definition:

<StructLayout(LayoutKind.Explicit)> _
Structure BY_HANDLE_FILE_INFORMATION
  <FieldOffset(0)> Public dwFileAttributes As Int32
  <FieldOffset(4)> Public ftCreationTime As Int64         ' FILETIME
  <FieldOffset(12)> Public ftLastAccessTime As Int64      ' FILETIME
  <FieldOffset(20)> Public ftLastWriteTime As Int64       ' FILETIME
  <FieldOffset(28)> Public dwVolumeSerialNumber As Int32
  <FieldOffset(32)> Public nFileSizeHigh As Int32
  <FieldOffset(36)> Public nFileSizeLow As Int32
  <FieldOffset(40)> Public nNumberOfLinks As Int32
  <FieldOffset(44)> Public nFileIndexHigh As Int32
  <FieldOffset(48)> Public nFileIndexLow As Int32
End Structure

User-Defined Field Types:

None.

Notes:

In C# You must remember about alignement!

So,

You can use `Pack': [StructLayout(LayoutKind.Sequential, Pack=4)]

Or, as is in VB example, use:

[StructLayout(LayoutKind.Explicit)]

with [FieldOffset()] for every field of structure.

This is, I think, better way.

Otherwise, You can get strange values in fields after GetFileInformationByHandle - in Win/64

Documentation